package com.zzty.txj1.dao;


import com.zzty.txj1.entity.Search;
import com.zzty.txj1.entity.SelfExam;
import com.zzty.txj1.entity.SelfExamTransaction;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SelfExamDao {
    @Select("select * from selfExam")
    List<SelfExam> getAllSelfExam();
    @Insert("insert into selfExam (questionId,classId,date) values (#{questionId},#{classId},#{date})")
    Integer addSelfExam(SelfExam selfExam);
    @Select("select * from selfExam where classId=#{clazzId} and date between #{bDate} and #{eDate}")
    List<SelfExam> getSelfExam(Search search);
    @Select("select * from selfExam where classId=#{classId} and date=#{date}")
    SelfExam checkByDateAndClazzId(SelfExam selfExam);

    @Insert("insert into selfExam (questionId,classId,date) values (#{questionId},#{classId},#{date})")
    Integer insertSelfExam(SelfExam selfExam);

    @Select("select * from selfExam where classId=#{classId} and date=#{date}")
    SelfExam checkHomework(SelfExam selfExam);

    @Select("select * from selfExam where classId=#{classId}")
    List<SelfExam> getSelfExamByClazzId(SelfExam selfExam);

    @Select("select * from selfExam where id=#{selfExamId}")
    SelfExam getSelfExamById(SelfExamTransaction selfExamTransaction);



}
